package com.flame.system.monitor.exception;

import com.flame.core.exception.ExceptionLevel;
import com.flame.core.exception.ExceptionMessage;

import java.text.MessageFormat;

public enum MonitorExceptionMessage implements ExceptionMessage {

    PATH_INVALID("100001", "节点路径需以'/'为开头", ExceptionLevel.INFO),
    CHILDREN_NOT_EMPTY("100001", "删除失败，请先删除下级节点", ExceptionLevel.INFO),
    NODE_EXIST("100001", "节点已存在，请刷新重试", ExceptionLevel.INFO),
    NODE_NOT_EXIST("100001", "节点不存在，请刷新重试", ExceptionLevel.INFO);

    private String code;

    private String message;

    private ExceptionLevel level;

    MonitorExceptionMessage(String code, String message, ExceptionLevel level) {
        this.code = code;
        this.message = message;
        this.level = level;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public String getMessage(Object... args) {
        return MessageFormat.format(this.message, args);
    }

    @Override
    public ExceptionLevel getLevel() {
        return level;
    }
}
